package com.xx.news.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.xx.news.activity.JingxuanActivity;
import com.xx.news.activity.QicheActivity;
import com.xx.news.activity.ShipinActivity;
import com.xx.news.activity.ToutiaoActivity;
import com.xx.news.activity.XinwenActivity;
import com.xx.news.activity.YuleActivity;
import com.xx.news.activity.YunDongActivity;
import com.xx.news.base.BaseViewModel;

public class MainViewModel extends BaseViewModel {
    public String[] items = new String[]{
            "头条",
            "精选",
            "娱乐",
            "汽车",
            "新闻",
            "运动",
            "视频"
    };

    public MainViewModel(@NonNull Application application) {
        super(application);
        ButtonName1.set(items[0]);
        ButtonName2.set(items[1]);
        ButtonName3.set(items[2]);
        ButtonName4.set(items[3]);
        ButtonName5.set(items[4]);
        ButtonName6.set(items[5]);
        ButtonName7.set(items[6]);
    }

    public ObservableField<String> ButtonName1 = new ObservableField<String>();
    public ObservableField<String> ButtonName2 = new ObservableField<String>();
    public ObservableField<String> ButtonName3 = new ObservableField<String>();
    public ObservableField<String> ButtonName4 = new ObservableField<String>();
    public ObservableField<String> ButtonName5 = new ObservableField<String>();
    public ObservableField<String> ButtonName6 = new ObservableField<String>();
    public ObservableField<String> ButtonName7 = new ObservableField<String>();

    //    public void onClick11(View view) {
    public void onClickView(String index) {
        System.out.println("================================================================================" + index);
        if (items[0].equals(index)) {
            startActivity(ToutiaoActivity.class);
        } else if (items[1].equals(index)) {
            startActivity(JingxuanActivity.class);
        } else if (items[2].equals(index)) {
            startActivity(YuleActivity.class);
        } else if (items[3].equals(index)) {
            startActivity(QicheActivity.class);
        } else if (items[4].equals(index)) {
            startActivity(XinwenActivity.class);
        } else if (items[5].equals(index)) {
            startActivity(YunDongActivity.class);
        } else if (items[6].equals(index)) {

            startActivity(ShipinActivity.class);
        }
    }

}
